package cn.itcast.service;

import cn.itcast.dao.UserDao;
import cn.itcast.feign.UserFeignClient;
import cn.itcast.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserService {

  ///  @Autowired
 //   private UserDao userDao;
    @Autowired
    private UserFeignClient userFeignClient;

    // 模拟多次查询
    public List<User> queryUserByIds(List<Long> ids){
        List<User> users = new ArrayList<>();
        for (Long id : ids) {
           User user = this.userFeignClient.queryUserById(id);
            users.add(user);
        }
        return users;
    }
}